<?php

namespace app\ruinuo\controller;
use app\common\model\RuinuoApp;
use app\common\model\RuinuoForm;
use app\common\model\RuinuoLists;
use app\common\model\RuinuoMode;
use app\ruinuo\design\Curd as ThatCurd;
class Curd
{
    public function FileCode($mode_id=0)
    {
        $RuinuoApp = new RuinuoApp();
        $RuinuoMode = new RuinuoMode();
        $RuinuoForm = new RuinuoForm();
        $RuinuoLists = new RuinuoLists();
        $mode = $RuinuoMode->where("id='" . $mode_id . "'")->findOrEmpty()->toArray();
        $app = $RuinuoApp->where("id='" . $mode['app_id'] . "'")->findOrEmpty()->toArray();
        $form = $RuinuoForm->where("mode_id='" . $mode_id . "'")->findOrEmpty()->toArray();
        $Lists = $RuinuoLists->where("mode_id='" . $mode_id . "'")->order('sort asc,id asc')->select()->toArray();
        $Config=[
            'app'=>$app,
            'mode'=>$mode,
            'form'=>$form,
            'lists'=>$Lists,
        ];
        $ThatCurd = new ThatCurd();
        $ThatCurd->File($Config);
        $ThatCurd->ControllerPhp($Config);
        $ThatCurd->InfoPhp($Config);
        $ThatCurd->ModePhp($Config);
        $ThatCurd->ListsPhp($Config);
        $ThatCurd->LogicPhp($Config);
        $ThatCurd->FormHtml($Config);
        $ThatCurd->ListsHtml($Config);
        $ThatCurd->ConfigJs($Config);
        $ThatCurd->FormJs($Config);
        $ThatCurd->ListsJs($Config);
        return BackCode();
    }


}